<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<input type="text" id="content">
<button id="btn">获取输入的内容</button>
<script>
var content = document.getElementById("content");
var btn = document.getElementById("btn");
btn.onclick = function (){
    var val = +content.value;
    alert(val)
}
</script>
</body>
</html>